#include<stdio.h>    
#include<unistd.h>//execl的头文件  
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>
int main()
{
        printf("I am a process, pid: %d\n", getpid());
        pid_t id = fork();
        if(id == 0)
        {
                 sleep(3);
                 printf("exec begin...\n");

                 char* argv[]={"ls","-l","-a",NULL};    
                 execv("/usr/bin/ls",argv);
                //execl("/usr/bin/ls", "ls", "-l", NULL);
                // execlp("ls","ls","-l","-a",NULL); 

                 printf("exec end ...\n");

                 exit(1);
        }
        pid_t rid = waitpid(id, NULL, 0);
        if(rid > 0)
        {
                printf("wait sucess\n");
        }
        exit(1);
}
